<template>
  <div class="a-input-button-wrap" ref="inputAntButton">
    <Ainput v-on="$listeners" :instance="instance" @enterChange="btnCb"></Ainput>
    <a-button 
      v-if="instance.btnOpt" 
      v-bind="instance.btnOpt" 
      :style="instance.btnOpt.style"
      :loading="loading"
      class="inputAntBtn"
      :class="instance.btnOpt.btnClass" 
      @click="btnCb">{{instance.btnOpt.title}}</a-button>
  </div>
  
</template>

<script>
import Ainput from './Ainput.vue'
export default {
  props: {
    instance: Object // 配置
  },
  data() {
    return {
      loading: false,
    }
  },
  components: {
    Ainput
  },
  methods: {
    // 查询按钮的回调时间
    async btnCb() {
      const { customOperation } = this.instance.btnOpt
      if(customOperation) {
        await customOperation.call(this, this.instance)
      }
    }
  }
}
</script>
